package test.study.concurrent.thread._2_executor.scheduled;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Slf4j
public class _4_ScheduledThreadPoolExecutor_Main {

    private static ScheduledThreadPoolExecutor POOL = new ScheduledThreadPoolExecutor(10);

    /**
     * 固定延迟调度
     *
     * @param command      Runnable
     * @param initialDelay long
     * @param delay        long
     * @param unit         TimeUnit
     */
    public static void main(String[] args) {
        log.info("主线程开始");
        POOL.scheduleWithFixedDelay(() -> {
            log.info("fffadsfasdf");
        }, 5, 7, TimeUnit.SECONDS);
        log.info("主线程结束");
    }
}
